package se.gu.sem;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TabHost;

@SuppressWarnings("deprecation")
public class PracticalInfo extends TabActivity{
	 
	TabHost TabPrac;

    @Override
    public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
        // Use our own list adapter
                  
          
          GUApp univ = ((GUApp)getApplicationContext());
          
          if(univ.getUniv().equals("GU"))
        	  setContentView(R.layout.gupracticalinfo);
          else if(univ.getUniv().equals("CH"))
        	  setContentView(R.layout.chpracticalinfo);
       
          
          TabPrac = getTabHost();
          
          TabPrac.addTab(TabPrac.newTabSpec("LunchLind").setIndicator("Lunches\n at Lindholmen").setContent(R.id.textview1));
          TabPrac.addTab(TabPrac.newTabSpec("StudyCons").setIndicator("Study\n Consellour").setContent(R.id.textview2));
          TabPrac.addTab(TabPrac.newTabSpec("AvailCourses").setIndicator("Available\n Courses").setContent(R.id.textview3));
          TabPrac.addTab(TabPrac.newTabSpec("CourseSched").setIndicator("Course\n Schedule").setContent(R.id.textview4));
          
          TabPrac.setCurrentTab(0);
    }
    

	  
	   @Override
	    public boolean onCreateOptionsMenu(Menu menu) {
	        MenuInflater inflater = getMenuInflater();
	        inflater.inflate(R.menu.menuprac, menu);
	        return true;
	    }
	    
	   @Override
	    public boolean onOptionsItemSelected(MenuItem item)
	    {    	
	    if(item.getTitle().toString().equals("Home"))
	    {	
	    	System.out.println();
	    	   Intent intent = new Intent(PracticalInfo.this,GUActivity.class);
	    	   startActivity(intent);    
	    	   return true;
	     }
	    if(item.getTitle().toString().equals("Register for an exam"))
	    {    
	    	System.out.println();
	   	   Intent intent = new Intent(PracticalInfo.this,RegisterActivity.class);
	   	   startActivity(intent);    
	   	   return true;
	    }
	      if(item.getTitle().toString().equals("Program Info"))
	      {
	      	System.out.println();
	      	Intent intent = new Intent(PracticalInfo.this,ProgrameInfoActivity.class);
	      	startActivity(intent);    
	      	return true;   
	      }
	       
	      if(item.getTitle().toString().equals("Twitter"))
	      {    
	    	  
	    	  GUApp univ = ((GUApp)getApplicationContext());
	    	  univ.setView("twitter");
	    	  
	     	  Intent intent = new Intent(PracticalInfo.this,LoadingScreen.class);
	     	  startActivity(intent);    
	     	  return true;
	      }
	      
	      if(item.getTitle().toString().equals("About"))
	      {    

	     	   Intent intent = new Intent(PracticalInfo.this,AboutActivity.class);
	     	   startActivity(intent);    
	     	   return true;
	      }
	       
	     return super.onOptionsItemSelected(item);
	    
	    }
}
